<?php
/* @var $this PageController */
/* @var $model Page */
?>

<?php
$this->breadcrumbs = array(
	'Страницы' => array('index'),
	'Создать страницу',
);
?>
<div class="row-fluid">
    <div class="span12">
        <div class="grid simple">
			<div class="grid-title no-border">
				<h4>Поля с <span class="required"> * </span> обязательны для заполнения.</h4>
			</div>
			<div class="grid-body no-border">
				<?php
				$this->renderPartial('_form', array('model' => $model, 'pageTitle'=>$pageTitle));
//				$this->widget('xupload.XUpload', array(
//					'url' => Yii::app()->createUrl("main/main/upload"),
//					'model' => new XUploadForm,
//					'attribute' => 'file',
//					'multiple' => true,
//					'options' => array(
//						'maxFileSize' => 5000000,
//						'acceptFileTypes' => "js:/(\.|\/)(jpe?g|png)$/i",
//						'completed' => 'js:function (event, files, index, xhr, handler, callBack) { addHiddenFields(files["result"]); }',
//					)
//				));
				?>
				
			</div>
        </div>	
    </div>
</div>
<script>
	function addHiddenFields(files)
	{
		for(var key in files)
		{
			var file = files[key];

			var input = $('<input>');
			input.attr("type","hidden");
			input.attr("name", "pageImages");
			input.attr("value", file);
			console.log(input);
		}
	}
</script>